/**
 * pharma-model - 9 janv. 2011 guillaume
 */
package org.bspv.pharma.model.security;

import org.springframework.security.core.GrantedAuthority;

/**
 * @author guillaume
 */
public class Authority implements GrantedAuthority {

    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = -3129486970645014608L;
    /**
     * authority.
     */
    private String authority;

    /**
     * Constructeur vide.
     */
    public Authority() {
    }

    /**
     * Constructeur.
     *
     * @param authority
     *            authority
     */
    public Authority(final String authority) {
        this.authority = authority;
    }

    /**
     * @param authority
     *            the authority to set
     */
    public final void setAuthority(final String authority) {
        this.authority = authority;
    }

    /**
     * getter.
     *
     * @return String
     */
    public final String getAuthority() {
        return authority;
    }

    /**
     * CompareTo.
     *
     * @param grantedAuthority
     *            Autre {@link Authority}
     * @return int
     */
    public final int compareTo(final Object grantedAuthority) {
        int res = -1;
        if (grantedAuthority != null) {
            res = this.authority.compareTo(((GrantedAuthority) grantedAuthority).getAuthority());
        }
        return res;
    }

}
